#include "lf_server.h"
#include "Log.h"
#include "LocalFeaturesSearch.h"

int lf_extract_server::start(){
	string name = "lf_extact";
	set_name(name);
/*	
	string ip = "199.155.122.11";
	string port = "44501";
	set_ip(ip);
	set_port(port);

	ip = "199.155.122.11";
	port = "44504";
	address addr(ip,port);
	add_match_server(addr);
*/
	int ret = 0;
	ret = LocalFeatures::load_resource("/home/brght/data/CentersFile/");
	if(ret != 0){
		LOG_ERROR_VA("Global init failed");
		return -1;
	}
	LOG_INFO_VA("LocalFeatures::version: ");
	LocalFeatures::version();

	LOG_INFO_VA("[%s] server start", get_name().c_str());
	server::start();
	return 0;
}

int lf_merge_server::start(){
	string name = "lf_merge";
	set_name(name);
/*	
	string ip = "199.155.122.11";
	string port = "44504";
	set_ip(ip);
	set_port(port);
*/

	LOG_INFO_VA("[%s] server start", get_name().c_str());
	server::start();

	return 0;
}

int lf_match_server::start(){
	string name = "lf_match";
	set_name(name);
/*	
	string ip = "199.155.122.11";
	string port = "44504";
	set_ip(ip);
	set_port(port);
*/
	database_bdb *db = new database_bdb;
	set_database(db);

	std::string data_path = "/home/murphy/coderoot/projects/v-search/trunk/data/db/";
	LOG_INFO_VA("[%s] data_path: %s",get_name().c_str(),data_path.c_str());
	get_database()->set_data_root_path(data_path);
	
	LOG_INFO_VA("[%s] server start", get_name().c_str());
	server::start();

	return 0;
}




